import { LayerEventType } from '../../src/event/EventType.js';
import { Earth } from '../../src/index.js';
import Layer from '../../src/layer/Layer.js';

/**
 * 注册Layer的事件监听
 * @param {} layer 
 */
export function registerLayerEvent(earth, layer){
    layer.on(LayerEventType.ADD, function(evt){
        console.log('图层['+ evt.obj.name + ']: ADDED');
    })

    layer.on(LayerEventType.LOADED, function(evt){
        console.log('图层['+ evt.obj.name + ']: LOADED');
        earth.zoomTo(layer);
    })
}
